<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body,
        p,
        input {
            margin: 0;
            padding: 0;
        }

        #box {
            border: 1px solid #0ff;
            font: 15px/2 Arial;
            width: 400px;
            margin: 10px auto;
            text-align: center;
        }

        #box p {
            color: #0ff;
            border-bottom: 1px solid #0ff;
            text-align: left;
            padding: 2px 10px;
        }

        #down span {
            display: inline-block;
            text-align: right;
            width: 80px;
        }

        #btn {
            width: 100px;
            height: 30px;
            font-size: 18px;
            font-weight: 600;
            border: none;
            border-radius: 5px;
            color: #fff;
            background: #0ff;
        }

        #down .focus {
            background-color: #0ff;
        }
    </style>
    </style>
</head>

<body>
    <div id="box">
        <p>用户登录</p>
        <div id="down">
            <span>用户名：</span><input type="text" /><br />
            <span>密码：</span><input type="password" /><br />
            <input type="button" value="登 陆" id="btn">
        </div>
    </div>
</body>

</html>
<script>
    var input = document.querySelectorAll('input')
    input[0].onclick = function () {
        input[0].style.background = '#0ff'
        input[1].style.background = ''
    }
    input[1].onclick = function () {
        input[1].style.background = '#0ff'
        input[0].style.background = ''
    }
</script>